using UnityEngine;

public class MotoBehavior : CarBehavior
{
	public float minSpeedToCrush = 20f;

	public float angleForCrush = 80f;

	public int demageOnSpeedExit = 5;

	public int minDemagueForCrush;

	protected override void DemageOnCollision(int resultDamage, int idKiller)
	{
		base.DemageOnCollision(resultDamage, idKiller);
		if (resultDamage > minDemagueForCrush && RCCcar.speed > minSpeedToCrush)
		{
			RiseEvent(this, "Crush", resultDamage);
		}
	}

	public override Transform GetOut(Humanoid player, bool withAnim)
	{
		if ((RCCcar.speed > minSpeedToCrush || inWater) && !player.isDead)
		{
			RiseEvent(this, "Crush", demageOnSpeedExit);
		}
		base.GetOut(player, withAnim);
		return base.transform;
	}

	public override void Update()
	{
		base.Update();
		if (base.isMine)
		{
			float num = base.transform.localEulerAngles.z;
			if (num > 180f)
			{
				num -= 360f;
			}
			if (num < 0f - angleForCrush || num > angleForCrush)
			{
				RiseEvent(this, "Crush", demageOnSpeedExit);
			}
		}
	}

	[PunRPC]
	public override void HideCarOnline()
	{
		BCWDebug.Log("HideCarOnline");
		base.transform.position = new Vector3(0f, -1000f, 0f);
	}

	[PunRPC]
	public override void StopDrive()
	{
		Disable();
	}
}
